package com.cango.student;

import com.cango.student.inter.inter1;

public class Stringintern {
    public static String Str3 = "www.runoob.com";
    public static void main(String[] args) {
        String Str1 = new String("www.runoob.com");
        String Str2 = "www.runoob.com";

        System.out.println(Str1 == Str2); // false
        System.out.println(Str2 == Str3); // true

        String b = new String("abc");
        String a = b.intern();
        String c = "abc";

        System.out.println(a == b); // false 写进常量池，但是由于常量池地址与新的new不等
        System.out.println(a == c); // true

        // 静态方法块
        TTest t1 = new TTest();
        TTest t2 = new TTest();


    }

}

class TTest {
    static {
        System.out.println("TTT");
    }
}
